package entities;

import java.util.Date;

import api.entitites.IOrder;
import api.entitites.OrderStatus;

public class Order implements IOrder, Cloneable{


	public OrderStatus orderStatus = null;
	public int number;
	private Date fillingDate;
	private Date deadlineDate;
	private Date beginingDate;
	private Integer price;
	private Integer id_master;
	private Integer id_garage;
	

	
	public void setNumberOrder(int number) {
		this.number = number;
	}

	public void setFillingDate(Date fillingDate) {
		this.fillingDate = fillingDate;
	}

	public void setDeadlineDate(Date deadlineDate) {
		this.deadlineDate = deadlineDate;
	}

	public void setBeginingDate(Date beginingDate) {
		this.beginingDate = beginingDate;
	}

	public void setPrice(int price) {
		this.price = price;
	}

	public void sendMasterGarage(Integer id_master, Integer id_garage) {
		this.id_master = id_master;
		this.id_garage = id_garage;
		
	}

	public Integer getIdGarage() {
		return id_garage;
	}

	public int getNumberOrder() {
		return number;
	}

	public Date getFillingDate() {
		return fillingDate;
	}

	public Date getDeadlineDate() {
		return deadlineDate;
	}

	public Date getBeginingDate() {
		return beginingDate;
	}

	public Integer getPrice() {
		return price;
	}

	public Integer getIdMaster() {
		return id_master;
	}

	public void setOrderStatus(String ordSt) {
		if(ordSt.equals("CANCELED")){
			orderStatus=OrderStatus.CANCELED;
		}else if(ordSt.equals("DELETED")){
			orderStatus=OrderStatus.DELETED;
		}else if(ordSt.equals("MADE")){
			orderStatus=OrderStatus.MADE;
		}else{
			ordSt=null;
		}
		
	}

	public String getOrderStatus() {
		if(orderStatus!=null){
			return orderStatus.toString();
		}else{
			return null;
		}
		
	}

	public void shiftTime(Date deadlineDate) {
		this.deadlineDate = deadlineDate;
	}

	public IOrder cloneOrder() throws CloneNotSupportedException {
		
		return (IOrder) super.clone();
		
		
	}

}
